

import Singleton from "../../framework/bo/Singleton";
import LogicBoot from "../logic/LogicBoot";
import ClientContext from "./ClientContext";
import NetData from "../../framework/net/NetData";
import { UIManager } from "../../framework/manager/uiManager";
import { Constant } from "../../Enum/Enum";
import { Util } from "../../framework/utils/util";
import BundleManager from "../../framework/manager/BundleManager";
import { BundleType } from "../../Enum/FramworkEnums";

/** 全局启动程序，这里调用所有模块初始化 */
export default class GlobalBoot extends Singleton {
    public static get Instance(): GlobalBoot {
        return super.GetInstance<GlobalBoot>();
    }
    public async init(): Promise<void> {
        await BundleManager.Instance.initRescources();// 加载resources
        await new Promise((resolve) => {
            UIManager.instance.showDialog(Constant.PANEL_NAME.START_GAME, null, () => { resolve(null); });
        });
        // UIManager.instance.pushToPopupSeq(Constant.PANEL_NAME.LOADING01);
        console.log("初始化");
        UIManager.instance.showDialog(Constant.PANEL_NAME.LOADING01);
        await ClientContext.Instance.init();// 所有运行数据存放
        await NetData.init();
        await LogicBoot.Instance.init();// 游戏逻辑程序启动
        UIManager.instance.hideDialog(Constant.PANEL_NAME.LOADING01);
        // UIManager.instance.shiftFromPopupSeq(Constant.PANEL_NAME.LOADING01);

    }
}